package com.example.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.demo.form.User.ListUserForm;
import com.example.demo.model.entity.User;
import com.example.demo.model.vo.UserVo;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author: LKP
 * @create: 2020/11/25
 * @Description:
 * @FileName: TestMapper
 * @History:
 * @自定义内容：
 */
@Repository
public interface UserMapper extends BaseMapper<User> {

    /**
     * 根据名字获取用户数据
     *
     * @param name
     * @return
     */
    @Select("select id, name, age from user where name = #{name}")
    User getUserByName(String name);

    /**
     * 获取用户列表
     *
     * @param listUserForm 表单数据
     * @return 用户列表
     */
    @Select("SELECT id, name, age FROM `user` LIMIT #{current},#{size}")
    List<UserVo> listUser(ListUserForm listUserForm);

}
